﻿<!DOCTYPE>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <title>热表转工工序追溯记录</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
    <link rel="stylesheet" href="/InSiteWebApplication/Content/webuploader/webuploader.css" />
    <style type="text/css">
        .l-btn2
        {
            border: #d2d2d2 1px solid;
            font-family: Tahoma, Helvetica;
            font-size: 10px;
            cursor: pointer;
            font-weight: 500;
            text-decoration: none;
            height: 26px;
            color: #fff;
            background: #02bfbf;
        }
        .l-btn2:hover
        {
            color: #fff;
            background: #05d2d2;
        }
        .btnNews
        {
            height: 20px;
            width: 50px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 14px;
            margin: 2px 2px;
            cursor: pointer;
            color: Black;
            border-radius: 1px;
            box-shadow: 0px 1px 0px #3d6b93;
            line-height: 10px;
            text-align: center;
            text-decoration: none;
            transition: background-color 0.15s ease-in-out;
        }
    </style>
</head>
<body>
    <div id="mainSec">
        <div class="panelSection">
            <div class="easyui-panel " title="查询区域" style="padding: 3px; width: 100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
                <form id="queryForm" action="">
                <div style="margin: 3px 0px 3px 3px">
                    <div style="float: left;">
                        <div class="divLabel" style="margin-bottom: 5px">
                            订单号：</div>
                        <input id="txtMfgOrderName_qf" name="mfgOrderName" class="easyui-textbox" style="width: 120px;
                            height: 20px" />
                    </div>
                    <div style="float: left; margin-left: 10px;">
                        <div class="divLabel" style="margin-bottom: 5px">
                            件号：</div>
                        <input id="txtProductName_qf" name="productName" class="easyui-textbox" style="width: 120px;
                            height: 20px" />
                    </div>
                    <div style="float: left; margin-left: 10px;">
                        <div class="divLabel" style="margin-bottom: 5px">
                            子批次号：</div>
                        <input id="txtSubContainerName_qf" name="subContainerName" class="easyui-textbox"
                            style="width: 120px; height: 20px" />
                    </div>
                    <div style="float: left; margin-left: 10px;">
                        <div class="divLabel" style="margin-bottom: 5px">
                            主批次号：</div>
                        <input id="txtMainContainerName_qf" name="mainContainerName" class="easyui-textbox"
                            style="width: 120px; height: 20px" />
                    </div>
                    <div style="float: left; margin-left: 10px;">
                        <div class="divLabel" style="margin-bottom: 5px">
                            转工转出人：</div>
                        <input id="txtSendName_qf" name="sendEmpName" class="easyui-textbox" style="width: 120px;
                            height: 20px" />
                    </div>
                    <div style="float: left; margin-left: 10px;">
                        <div class="divLabel" style="margin-bottom: 5px">
                            转工接收人：</div>
                        <input id="txtReceiveName_qf" name="receiveEmpName" class="easyui-textbox" style="width: 120px;
                            height: 20px" />
                    </div>
                    <div style="float: left; margin-left: 10px;">
                        <div class="divLabel" style="margin-bottom: 5px">
                            转工完成人：</div>
                        <input id="txtCompleteName_qf" name="completeEmpName" class="easyui-textbox" style="width: 120px;
                            height: 20px" />
                    </div>
                    <div style="float: left; margin-left: 20px">
                        <a id="btnSearch" href='#' class="easyui-linkbutton" style="margin-top: 16px; width: 80px">
                            查询</a> <a id="btnReset" href='#' class="easyui-linkbutton" style="margin-top: 16px;
                                margin-left: 5px;">重置</a>
                    </div>
                    <div style="clear: both">
                    </div>
                </div>
                </form>
            </div>
        </div>
        <div class="panelSection">
            <div class="easyui-panel " title="结果区域" style="padding: 3px; width: 100%" data-options="closable:false,collapsible:true,minimizable:false,maximizable:false">
                <div style="margin: 3px 0px 3px 3px; width: 99%;">
                    <table id="gdContainerInfo" class="easyui-datagrid" style="width: 100%;" data-options="fitColumns:true,rownumbers:true">
                    </table>
                    <div id="pp" style="float: right" class="easyui-pagination" data-options="   
                 layout:['list','first','prev','next','last','manual','info'],              
                    total: 0,
                    showPageList: true,
                    showPageInfo: false,
                    showRefresh: false,
                    afterPageText:'共&nbsp{pages}&nbsp页',
                    buttons:[{
                            iconCls:'',
                            text:'Go',
                            id:'pageGo'
                    }]  
                ">
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/ReferenceJsLib.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script type="text/javascript" src="/InSiteWebApplication/Content/webuploader/webuploader.js"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script type="text/javascript">
    /*
    创建人：zhangrj
    日期：2024-07-05
    描述：热表转工工序追溯记录js
    */
    var page = {
        pageTotal: 0,
        pageSize: 20,
        pageNumber: 1,
        rootPath: getRootPath(), //网站根路径
        url: getRootPath() + "/Ashx/ReBiaoConainer/RbContainerTraceBackHandler.ashx",
        commonUrl: getRootPath() + "/Ashx/CommonHandler.ashx",
        //初始化页面
        init: function () {
            page.bind();
            customizedEasyuiPagination('pp'); //定制化分页
        },
        //页面事件绑定
        bind: function () {
            //列表加载
            $("#gdContainerInfo").datagrid({
                onLoadSuccess: function (data) {
                    $('#pp').pagination('refresh', {	// 改变选项，并刷新分页栏信息
                        total: page.pageTotal,
                        pageSize: page.pageSize,
                        pageNumber: page.pageNumber
                    });
                    customizedEasyuiPagination('pp'); //定制化分页
                },
                columns: [[
                 { field: 'MFGORDERNAME', title: '订单号', width: 120 },
                 { field: 'PRODUCTNAME', title: '零件号', width: 120 },
                 { field: 'SUBCONTAINERNAME', title: '子批次名', width: 180 },
                 { field: 'MAINCONTAINERNAME', title: '主批次名', width: 150 },
                 { field: 'QTY', title: '转工数量', width: 100 },
                 { field: 'WORKFLOWSTEPNAME', title: '转工工序', width: 150 },
                 { field: 'SENDEMPNAME', title: '转出人', width: 80 },
                 { field: 'SENDETIME', title: '转出时间', width: 120, formatter: function (value, row, index) {
                     if (!isNullOrWhiteSpaceStr(value)) {
                         return dayjs(value).format('YYYY-MM-DD HH:mm:ss');
                     }
                 }
                 },
                 { field: 'RECIVEEMPNAME', title: '接收人', width: 80 },
                 { field: 'RECIVETIME', title: '接收时间', width: 120, formatter: function (value, row, index) {
                     if (!isNullOrWhiteSpaceStr(value)) {
                         return dayjs(value).format('YYYY-MM-DD HH:mm:ss');
                     }
                 }
                 },
                 { field: 'COMPLETEEMPNAME', title: '完成人', width: 80 },
                 { field: 'COMPLETETIME', title: '完成时间', width: 120, formatter: function (value, row, index) {
                     if (!isNullOrWhiteSpaceStr(value)) {
                         return dayjs(value).format('YYYY-MM-DD HH:mm:ss');
                     }
                 }
                 },
                 { field: 'FILEDOCPATH', title: '附件', width: 150, formatter: function (value, row, index) {
                     var data = [];
                     data.push(row);
                     return "<button type='button' class='btnNews' onclick='page.viewDoc(" + JSON.stringify(data) + ")'>查看</button>" +
                      "<button type='button' class='btnNews' onclick='page.fileDownLoad(" + JSON.stringify(data) + ")'>下载</button>";
                 }
                 }
                ]]
            });
            //查询按钮
            $('#btnSearch').on("click", function () {
                page.clearPage(false, true);
                page.searchData();
            });
            //清除按钮
            $('#btnReset').on("click", function () {
                page.clearPage(true, true);
            });
            //分页事件
            $('#pp').pagination({
                onSelectPage: function (pageNumber, pageSize) {
                    //customizedEasyuiPagination('pp'); //定制化分页
                    page.pageSize = pageSize; page.pageNumber = pageNumber === 0 ? 1 : pageNumber;
                    page.searchData();
                }
            });
            //绑定分页go按钮
            $('#pageGo').on("click", function () {
                var pageNumber = Number($(this).parents('tr').find('.pagination-num').val());
                page.pageSize = $(".pagination-page-list").val();
                page.pageNumber = pageNumber;
                page.searchData();
            });
        },
        //查询
        searchData: function () {
            var params = {
                action: "GetRbContainerTraceBackList",
                pageSize: page.pageSize,
                pageIndex: page.pageNumber
            };
            var queryFormData = $("#queryForm").serializeArray();
            $.each(queryFormData, function () {
                params[this.name] = this.value;
            });
            page.post(page.url, params, true, function (res) {
                if (!res.Result) {
                    displayMessage(res.Message, res.Result);
                    return;
                }
                page.pageTotal = res.RowCount;
                $("#gdContainerInfo").datagrid('loadData', { total: res.RowCount, rows: res.DBTable });
            });
        },
        //查看文件
        viewDoc: function (row) {
            window.open(page.rootPath + "/" + row[0].FILEDOCPATH);
        },
        //下载文件
        fileDownLoad: function (row) {
            var a = window.document.createElement('a');
            a.href = page.rootPath + "/" + row[0].FILEDOCPATH;
            a.download = row[0].FILENAME;
            document.body.appendChild(a);
            a.click();
            document.body.removeChild(a);
        },
        //禁用页面按钮
        disableBtn: function () {
            $("#mainSec").find(".easyui-linkbutton").each(function () {
                $(this).linkbutton('disable');
            });
        },
        //启用页面按钮
        enableBtn: function () {
            $("#mainSec").find(".easyui-linkbutton").each(function () {
                $(this).linkbutton('enable');
            });
        },
        //清除页面（查询区域，列表区域）
        clearPage: function (query, list) {
            if (query) {
                $("#txtMfgOrderName_qf").textbox("clear");
                $("#txtProductName_qf").textbox("clear");
                $("#txtSubContainerName_qf").textbox("clear");
                $("#txtMainContainerName_qf").textbox("clear");
                $("#txtSendName_qf").textbox("clear");
                $("#txtReceiveName_qf").textbox("clear");
                $("#txtCompleteName_qf").textbox("clear");
            }
            if (list) {
                clearEasyuiDataGrid("gdContainerInfo"); //清空列表
            }
        },
        //post数据（路径，参数，是否异步，成功返回方法）
        post: function (url, param, async, callback) {
            $.ajax({
                type: "Post",
                url: url,
                data: param,
                cashe: false,
                async: async,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                    $("body").find(".easyui-linkbutton").each(function () {
                        $(this).linkbutton('enable');
                    });
                }
            });
        }
    };
    $(function () {
        page.init();
    });
</script>
